<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Jquery test</title>
		<style>
			#div{
				position: absolute;
				top: 100px;
				width: 100px;
				height: 100px;
				background-color: #c0c0c0;
			}
		</style>
		<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
		<script>
			var t = 150;
			function go(d){
				var d = d || $("#div");
				d.animate({top: t+"px"}, 400, function(){go(d)});
				t = (t == 150) ? 100 : 150;
			}
			
			function stop(){
				var d = d || $("#div");
				d.stop();
			}
		</script>
	</head>
	<body>
		<div id="div">hello</div>
		<button onclick="go()">go animate</button>
		<button onclick="stop()">stop animate</button>
	</body>
</html>
